<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var arrs=["a","b","c","d","e"];
        // 将数组中的元素存入到一个arrs2中，而arrs2中的最终结果是:["e","d","c","b","a"]
        var arrs2=[];
        for(var i=arrs.length-1;i>=0;i--){
            arrs2[arrs2.length]=arrs[i];//arrs2[0]=arrs[4]   arrs2[1]=arrs[3]  arrs2[2]=arrs[2]  arrs2[3]=arrs[1]  arrs[4]=arrs[0]
        }
        console.log(arrs2);

        // 提示用户输入6个学生的成绩存入到数组中去
        var scores=[];
        for(var i=0;i<6;i++){
            scores[i]=prompt("请输入第"+(i+1)+"个学生的成绩：")*1;

        }
        // console.log(scores);//[78,67,98,100,59,87]
        //找到上面这个数组中的最大值和最小值
        var max=scores[0];//假设数组中的第一个元素为最大值和最小值
        var min=scores[0];//假设数组中的第一个元素为最大值和最小值
        for(var i=0;i<scores.length;i++){                       //max=98         max=100
            if(max<scores[i]){//max<scores[0]    max<scores[1]  max<scores[2]   max<scores[3]  max<scores[4]  max<scores[5]
                max=scores[i];
            }
            if(min>scores[i]){
                min=scores[i];
            }
        }
        console.log("最大值:"+max+",最小值:"+min);





        
  

    </script>
</head>
<body>
    
</body>
</html>